#ifndef PUBLIC_H
#define PUBLIC_H

#include <iostream>
#include <string.h>
#include <stdio.h>

#define uint8      unsigned char
#define uint16    unsigned short
#define uint32    unsigned int
#define int8        signed char
#define int16      signed short
#define int32      signed int

/* takes a byte out of a uint32 : var - uint32,  ByteNum - byte to take out (0 - 3) */
#define BREAK_UINT32( var, ByteNum )     (uint8)((uint32)(((var) >>((ByteNum) * 8)) & 0x00FF))

#define HI_UINT16(a) (((a) >> 8) & 0xFF)
#define LO_UINT16(a) ((a) & 0xFF)
#define HI_UINT8(a) (((a) >> 4) & 0x0F)
#define LO_UINT8(a) ((a) & 0x0F)

#define BUILD_UINT32(Byte0, Byte1, Byte2, Byte3) \
          ((uint32)((uint32)((Byte0) & 0x00FF) \
          + ((uint32)((Byte1) & 0x00FF) << 8) \
          + ((uint32)((Byte2) & 0x00FF) << 16) \
          + ((uint32)((Byte3) & 0x00FF) << 24)))

#define BUILD_UINT16(loByte, hiByte)    ((uint16)(((loByte) & 0x00FF) + (((hiByte) & 0x00FF) << 8)))
#define BUILD_UINT8(hiByte, loByte)   ((uint8)(((loByte) & 0x0F) + (((hiByte) & 0x0F) << 4)))

#define TIMEOUT_ACTUATOR    3000

#define ON   1
#define OFF  0

void convertUnCharToStr(char* str, unsigned char* UnChar, int ucLen);
void convertStrToUnChar(char* str, unsigned char* UnChar);

#endif // PUBLIC_H
